package com.zy.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * [redisson实现分布式锁]
 *
 * @author : [张宇]
 * @version : [v1.0]
 * @createTime : [2024/12/19 16:34]
 */

@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient(){
        // 创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://47.94.11.62:6379").setPassword("275295").setDatabase(2);
        // 创建redissonClient对象
        return Redisson.create(config);
    }
}
